Skip to content

[AutoPR azure-ai-contentunderstanding]-generated-from-SDK Generation - Java-5634426#47441

Closed
azure-sdk wants to merge 123 commits intoAzure:mainfrom
azure-sdk:sdkauto/azure-ai-contentunderstanding-5634426
Closed

[AutoPR azure-ai-contentunderstanding]-generated-from-SDK Generation - Java-5634426#47441
azure-sdk wants to merge 123 commits intoAzure:mainfrom
azure-sdk:sdkauto/azure-ai-contentunderstanding-5634426

Conversation

@azure-sdk
Copy link
Collaborator

Configurations: 'specification/ai/ContentUnderstanding/tspconfig.yaml', API Version: 2025-11-01, SDK Release Type: beta, and CommitSHA: 'd0cd556bd91d2dda700e983c0d253fa025b324c0' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=5634426 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release. Release plan link: Submitted by:

@github-actions
Copy link
Contributor

github-actions bot commented Dec 3, 2025

API Change Check

APIView identified API level changes in this PR and created the following API reviews

com.azure:azure-ai-contentunderstanding

yungshinlintw and others added 24 commits December 4, 2025 05:38
… from .NET SDK

- Sample00_ConfigureDefaults: Demonstrates configuration management (get/update defaults)
- Sample01_AnalyzeBinary: Binary PDF analysis from local file
- Sample02_AnalyzeUrl: Analyze documents from URL
- Sample03_AnalyzeInvoice: Extract structured invoice fields with nested objects and arrays
- Sample04_CreateAnalyzer: Create and use custom analyzer with field schema (Extract/Generate/Classify methods)

Key features:
- All samples use DefaultAzureCredentialBuilder for authentication
- Environment variable based configuration (ENDPOINT)
- Comprehensive JUnit 5 tests with assertions
- GitHub public URLs for test data
- Proper field access patterns with type casting (ContentField, StringField, NumberField, ObjectField, ArrayField)
- All tests passing (6/6 = 100% success rate)

Technical implementation:
- Fixed API differences from C# SDK (ContentSpan, ContentField, 5-parameter beginAnalyze)
- Proper null checking and type casting for all field access
- Detailed validation assertions for all document properties
- Clean resource management with @AfterEach cleanup

Module-info.java formatting cleanup included.
- Sample05_CreateClassifier: Create classifier analyzer with multiple classification fields (document_type, industry, urgency)
- Sample06_GetAnalyzer: Get analyzer information including configuration and field schema

Key features:
- Sample05: Demonstrates classification-only analyzer with 3 classifiers
- Sample06: Shows how to retrieve and inspect analyzer properties including prebuilt analyzers
- Fixed API usage: getAnalyzerId(), getCreatedAt(), getLastModified At() instead of getId(), getCreatedDateTime(), getUpdatedDateTime()
- Comprehensive field schema inspection with all 31 prebuilt-invoice fields
- All tests passing with real Azure service
- Sample07_ListAnalyzers: List and filter all available analyzers (prebuilt and custom)
  * testListAnalyzersAsync: Lists all 134 analyzers (87 prebuilt, 47 custom)
  * testListReadyAnalyzersAsync: Filters for ready analyzers only
- Sample08_UpdateAnalyzer: Update existing analyzer properties
  * Demonstrates updating description, configuration, and field schema
  * Uses @beforeeach to create test analyzer and @AfterEach for cleanup
  * Shows how to add new fields while preserving existing ones

All tests passing with real Azure service
Fixed Sample08_UpdateAnalyzer to avoid 409 conflict error:
- Delete existing analyzer before recreating with updated configuration
- Added note about using updateAnalyzerWithResponse for atomic updates in production
- All 12 tests now passing (Sample00-08 with multiple test methods)

Test results: 12/12 passed (100% success rate)
…iables and Improve Test Patterns

- Updated environment variable names from "ENDPOINT" and "CONTENTUNDERSTANDING_API_KEY" to "CONTENTUNDERSTANDING_ENDPOINT" and "AZURE_CONTENT_UNDERSTANDING_KEY" across multiple sample test files.
- Modified sample tests to load local files instead of using publicly accessible URLs for document analysis.
- Enhanced assertions and logging for better clarity and debugging.
- Improved API usage patterns in tests for creating, copying, and deleting analyzers, including async patterns.
- Added model mappings for analyzers in relevant samples to demonstrate configuration capabilities.
…e validation of source and copied analyzers
… Azure Credential Authentication

- Updated Sample03_AnalyzeInvoice, Sample04_CreateAnalyzer, Sample05_CreateClassifier, Sample06_GetAnalyzer, Sample07_ListAnalyzers, Sample08_UpdateAnalyzer, Sample09_DeleteAnalyzer, Sample10_AnalyzeConfigs, Sample11_AnalyzeReturnRawJson, Sample12_GetResultFile, Sample13_DeleteResult, Sample14_CopyAnalyzer, Sample15_GrantCopyAuth, and Sample16_CreateAnalyzerWithLabels to include logic for initializing the Content Understanding client with either an API key or the Default Azure Credential.
- Added assertions to verify client initialization in each sample.
- Improved code readability and maintainability by consolidating client creation logic.
- Sample12_GetResultFile: Demonstrates how to retrieve keyframe images from video analysis operations.
- Sample13_DeleteResult: Shows how to delete analysis results after they are no longer needed.
- Sample14_CopyAnalyzer: Illustrates how to copy an analyzer within the same resource.
- Sample15_GrantCopyAuth: Demonstrates granting copy authorization for cross-resource analyzer copying.
- Sample16_CreateAnalyzerWithLabels: Shows how to create an analyzer with labeled training data from Azure Blob Storage.
@changjian-wang changjian-wang force-pushed the sdkauto/azure-ai-contentunderstanding-5634426 branch 3 times, most recently from 7bedda6 to e2af7aa Compare December 16, 2025 10:13
- Delete 13 @disabled test files (replaced by Sample tests)
- Modify Sample00-Sample16 to extend ContentUnderstandingClientTestBase
- Add testResourceNamer for reproducible random IDs in PLAYBACK mode
- Remove problematic sanitizers (AZSDK2003, AZSDK2030, AZSDK3423, AZSDK3430, AZSDK3493)
- Configure maven-surefire-plugin to include Sample*.java
- Use AZURE_CONTENT_UNDERSTANDING_ENDPOINT env var (matches .NET naming)
Copy link
Member

@bojunehsu bojunehsu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed customizations and README.md. Skimmed some samples. Skipped others.

@yungshinlintw
Copy link
Member

/azp run prepare-pipelines

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

chienyuanchang and others added 7 commits February 3, 2026 17:18
…ence methods. Added type-safe getValue() methods for ContentField, ObjectField, and ArrayField to simplify value retrieval without casting. Updated beginAnalyzeBinary convenience overloads to remove unnecessary parameters and enhance usability.
…ency and enhance README.md with clarifications on LLM requirements for analyzers.
@yungshinlintw yungshinlintw enabled auto-merge (squash) February 5, 2026 21:33
…and remove obsolete sample files. Updated paths in Sample01, Sample10, and Sample11 test classes to point to 'src/samples/resources/'. Deleted unused PDF files from 'src/test/resources/'.
auto-merge was automatically disabled February 28, 2026 05:50

Pull request was closed

yungshinlintw added a commit that referenced this pull request Mar 2, 2026
* Configurations:  'specification/ai/ContentUnderstanding/tspconfig.yaml', API Version: 2025-11-01, SDK Release Type: beta, and CommitSHA: 'd0cd556bd91d2dda700e983c0d253fa025b324c0' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=5634426 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release.

* SDK-GEN: Re-generate SDK based on commmit e11e268a65224bd90f3aa450d44ca4b0e1d5ed1c

* Add sample tests for configuring defaults and analyzing binary documents in Content Understanding SDK

* [ContentUnderstanding] Add Java samples (Sample00-Sample04) converted from .NET SDK

- Sample00_ConfigureDefaults: Demonstrates configuration management (get/update defaults)
- Sample01_AnalyzeBinary: Binary PDF analysis from local file
- Sample02_AnalyzeUrl: Analyze documents from URL
- Sample03_AnalyzeInvoice: Extract structured invoice fields with nested objects and arrays
- Sample04_CreateAnalyzer: Create and use custom analyzer with field schema (Extract/Generate/Classify methods)

Key features:
- All samples use DefaultAzureCredentialBuilder for authentication
- Environment variable based configuration (ENDPOINT)
- Comprehensive JUnit 5 tests with assertions
- GitHub public URLs for test data
- Proper field access patterns with type casting (ContentField, StringField, NumberField, ObjectField, ArrayField)
- All tests passing (6/6 = 100% success rate)

Technical implementation:
- Fixed API differences from C# SDK (ContentSpan, ContentField, 5-parameter beginAnalyze)
- Proper null checking and type casting for all field access
- Detailed validation assertions for all document properties
- Clean resource management with @AfterEach cleanup

Module-info.java formatting cleanup included.

* [ContentUnderstanding] Add Sample05 and Sample06

- Sample05_CreateClassifier: Create classifier analyzer with multiple classification fields (document_type, industry, urgency)
- Sample06_GetAnalyzer: Get analyzer information including configuration and field schema

Key features:
- Sample05: Demonstrates classification-only analyzer with 3 classifiers
- Sample06: Shows how to retrieve and inspect analyzer properties including prebuilt analyzers
- Fixed API usage: getAnalyzerId(), getCreatedAt(), getLastModified At() instead of getId(), getCreatedDateTime(), getUpdatedDateTime()
- Comprehensive field schema inspection with all 31 prebuilt-invoice fields
- All tests passing with real Azure service

* [ContentUnderstanding] Add Sample07 and Sample08

- Sample07_ListAnalyzers: List and filter all available analyzers (prebuilt and custom)
  * testListAnalyzersAsync: Lists all 134 analyzers (87 prebuilt, 47 custom)
  * testListReadyAnalyzersAsync: Filters for ready analyzers only
- Sample08_UpdateAnalyzer: Update existing analyzer properties
  * Demonstrates updating description, configuration, and field schema
  * Uses @beforeeach to create test analyzer and @AfterEach for cleanup
  * Shows how to add new fields while preserving existing ones

All tests passing with real Azure service

* [ContentUnderstanding] Fix Sample08 update conflict issue

Fixed Sample08_UpdateAnalyzer to avoid 409 conflict error:
- Delete existing analyzer before recreating with updated configuration
- Added note about using updateAnalyzerWithResponse for atomic updates in production
- All 12 tests now passing (Sample00-08 with multiple test methods)

Test results: 12/12 passed (100% success rate)

* [ContentUnderstanding] Add Sample09_DeleteAnalyzer

* [ContentUnderstanding] Fix Sample09 and remove incompatible Sample10-16

* Add Sample10_AnalyzeConfigs and Sample11_AnalyzeReturnRawJson

* Add Sample12_GetResultFile and Sample13_DeleteResult

* Add Sample14_CopyAnalyzer, Sample15_GrantCopyAuth, and Sample16_CreateAnalyzerWithLabels

* Refactor Content Understanding Samples to Use Updated Environment Variables and Improve Test Patterns

- Updated environment variable names from "ENDPOINT" and "CONTENTUNDERSTANDING_API_KEY" to "CONTENTUNDERSTANDING_ENDPOINT" and "AZURE_CONTENT_UNDERSTANDING_KEY" across multiple sample test files.
- Modified sample tests to load local files instead of using publicly accessible URLs for document analysis.
- Enhanced assertions and logging for better clarity and debugging.
- Improved API usage patterns in tests for creating, copying, and deleting analyzers, including async patterns.
- Added model mappings for analyzers in relevant samples to demonstrate configuration capabilities.

* Update Content Understanding Samples to Use DefaultAzureCredential for Authentication

* Update analyzer copy endpoint to use simplified path and expand expected responses

* Enhance verification steps in Sample14_CopyAnalyzer to ensure accurate validation of source and copied analyzers

* Refactor Content Understanding Samples to Support API Key and Default Azure Credential Authentication

- Updated Sample03_AnalyzeInvoice, Sample04_CreateAnalyzer, Sample05_CreateClassifier, Sample06_GetAnalyzer, Sample07_ListAnalyzers, Sample08_UpdateAnalyzer, Sample09_DeleteAnalyzer, Sample10_AnalyzeConfigs, Sample11_AnalyzeReturnRawJson, Sample12_GetResultFile, Sample13_DeleteResult, Sample14_CopyAnalyzer, Sample15_GrantCopyAuth, and Sample16_CreateAnalyzerWithLabels to include logic for initializing the Content Understanding client with either an API key or the Default Azure Credential.
- Added assertions to verify client initialization in each sample.
- Improved code readability and maintainability by consolidating client creation logic.

* Refactor Content Understanding Samples to Use Single Line for Client Builder Initialization

* Add samples for content understanding SDK

- Sample12_GetResultFile: Demonstrates how to retrieve keyframe images from video analysis operations.
- Sample13_DeleteResult: Shows how to delete analysis results after they are no longer needed.
- Sample14_CopyAnalyzer: Illustrates how to copy an analyzer within the same resource.
- Sample15_GrantCopyAuth: Demonstrates granting copy authorization for cross-resource analyzer copying.
- Sample16_CreateAnalyzerWithLabels: Shows how to create an analyzer with labeled training data from Azure Blob Storage.

* Update assets.json to include specific tag for content understanding SDK

* Update sample file paths and add new sample documents for content understanding SDK

* Disable JaCoCo coverage and Checkstyle for beta.1 - tests under development

* Fix JaCoCo coverage values: use 0 instead of 0.00

* Add UPCA and UPCE barcode terms to spelling dictionary

* Enable Record/Playback test mode for Sample tests

- Delete 13 @disabled test files (replaced by Sample tests)
- Modify Sample00-Sample16 to extend ContentUnderstandingClientTestBase
- Add testResourceNamer for reproducible random IDs in PLAYBACK mode
- Remove problematic sanitizers (AZSDK2003, AZSDK2030, AZSDK3423, AZSDK3430, AZSDK3493)
- Configure maven-surefire-plugin to include Sample*.java
- Use AZURE_CONTENT_UNDERSTANDING_ENDPOINT env var (matches .NET naming)

* Fix surefire include pattern to only match generated/Sample*.java

Exclude src/samples/.../samples/Sample*.java standalone examples from test execution.

* Fix double-slash issue in test recordings for Content Understanding

- Fixed URI mismatch issue where recorded URLs had double slashes (//contentunderstanding)
- Updated assets.json to point to new recordings tag (3de1635cfc)
- All 23 tests pass in PLAYBACK mode

* Fix double-slash issue in test recordings: update assets.json to new tag _41c669f1bc

* Strip trailing slash from endpoint to prevent double-slash in URLs

* Customize Content Understanding Java SDK to match .NET SDK patterns

- Fix SupportedModels deserialization (Map -> List)
- Add getOperationId() to ContentAnalyzerAnalyzeOperationStatus
- Add getValueObject() helper to ArrayField, ObjectField, ContentField
- Fix Sample12 operation ID retrieval
- Add graceful error handling for Sample14 copy operation
- Move sample tests to tests/samples package
- Update assets.json with new recording tag

* Update tests/samples to use convenience methods (getValue, getFieldOrDefault, size, get)

* Fix Sample03 InvoiceDate type casting - DateField returns LocalDate not String

* Fix CopyAnalyzer API issues and add test recordings

- Fix API path from :copyAnalyzer to :copy
- Fix ExpectedResponses to include 200, 201, 202
- Update pom.xml to include tests/samples in test execution
- Add @liveonly to cross-resource test (cannot replay)
- Update environment variable naming to match .NET SDK convention
- Add test recordings for all Sample tests (Sample00-Sample16)

* Update README.md with comprehensive documentation

- Add detailed product description and feature list
- Add Microsoft Foundry resource configuration guide (3 steps)
- Add DefaultAzureCredential and API key authentication examples
- Add Key concepts section (prebuilt analyzers, content types, async operations)
- Add troubleshooting section with common issues and logging
- Update all links to Java SDK resources

* Add cspell.json with custom words for spell checking

Add upca/upce words to prevent spell check errors

* Add azure-ai-contentunderstanding to version_client.txt

* Add customization to fix copyAnalyzer API path

The TypeSpec spec incorrectly uses ':copyAnalyzer' but the service uses ':copy'.
This customization adds code to fix the API path during post-processing.
Also expands ExpectedResponses from {202} to {200, 201, 202} to match service behavior.

Note: The current tsp-client CLI does not apply customizations during generation.
The source files already have the correct path manually applied.
This customization ensures the fix will persist through future regenerations
once the proper build pipeline runs.

* Remove incompatible generated samples and tests

* Stop hiding beginAnalyze methods to fix sample compilation

* Use ClientLogger for exception throwing to fix checkstyle linting errors

* TEST: Add test resource creation files and also tests.yml for CI

* Address PR review feedback for azure-ai-contentunderstanding SDK

Changes based on PR #47441 review comments from yungshinlintw:

1. Revert .vscode/cspell.json changes - removed upca/upce words (should be in SDK-local cspell.json)
2. Delete ReadmeSamples.java - empty placeholder file not needed
3. Rename Sample00_ConfigureDefaults.java to Sample00_UpdateDefaults.java - matches API name
4. Format assets.json - multi-line JSON for better readability
5. Enhance README Step 3 - add environment variables and Sample00 reference
6. Add 'Additional concepts' section to README - links to azure-core documentation

* Add sample test for updating default configuration in Content Understanding service

* Update assets.json to match renamed Sample00_UpdateDefaults test

* README: Fix incorrect reference

* Address PR review comments: use environment variables for model deployments and add updateAnalyzer/updateDefaults convenience methods

- Update Sample00 to use environment variables (GPT_4_1_DEPLOYMENT, GPT_4_1_MINI_DEPLOYMENT, TEXT_EMBEDDING_3_LARGE_DEPLOYMENT) for model deployments following Python SDK pattern
- Change AZURE_CONTENT_UNDERSTANDING_KEY to CONTENTUNDERSTANDING_KEY
- Fix print statements to use getModelDeployments() instead of object references
- Add updateAnalyzer(String, ContentAnalyzer) convenience method to sync and async clients
- Add updateDefaults(Map<String, String>) convenience method to sync and async clients
- Update Sample08 to use updateAnalyzer convenience method instead of delete/recreate pattern
- Make ContentUnderstandingDefaults constructor public for convenience methods

* Update README.md with model deployment environment variables

- Change AZURE_CONTENT_UNDERSTANDING_KEY to CONTENTUNDERSTANDING_KEY
- Add GPT_4_1_DEPLOYMENT, GPT_4_1_MINI_DEPLOYMENT, TEXT_EMBEDDING_3_LARGE_DEPLOYMENT environment variables to Step 3

* Fix CI linting errors: update convenience methods to return typed objects directly

The Azure SDK linting rules require:
1. Methods returning Response<T> must end with 'WithResponse'
2. Methods with @ServiceMethod must have RequestOptions parameter

Fixed by changing convenience methods to:
- Return typed objects directly (ContentAnalyzer, ContentUnderstandingDefaults)
  instead of wrapping in Response<T>
- Remove @ServiceMethod annotation from convenience methods
- Remove unused SimpleResponse imports

Updated files:
- ContentUnderstandingClient.java
- ContentUnderstandingAsyncClient.java
- ContentUnderstandingCustomizations.java
- Sample00_UpdateDefaults.java (samples and tests)
- Sample08_UpdateAnalyzer.java (samples and tests)

* Update test recordings for Sample00, Sample08, Sample14

* Update Sample12 to use getResultFile convenience method instead of getResultFileWithResponse

* Update Sample15 to use grantCopyAuthorization convenience method instead of commented protocol code

* Fix Step 3 comment to show correct beginCopyAnalyzer convenience method signature

* Address PR review comments and standardize environment variables

- Sample12: Use getResultFile() convenience method instead of getResultFileWithResponse()
- Sample15: Complete rewrite to implement full cross-resource copy workflow
  - Step 1: Create source analyzer on source resource
  - Step 2: Grant copy authorization on target resource
  - Step 3: Copy analyzer from source to target
  - Add proper cleanup for both source and target analyzers
- Add API key authentication support with DefaultAzureCredential fallback
- Rename AZURE_CONTENT_UNDERSTANDING_KEY to CONTENTUNDERSTANDING_KEY across all 15 samples
- Update JavaDoc for Sample15 with accurate environment variable names

* README: Update sample running instructions

* README: Update sample running instruction

* Refactor sample code to use environment variables for endpoint configuration

- Updated all sample files to replace Configuration.getGlobalConfiguration() with System.getenv() for retrieving CONTENTUNDERSTANDING_ENDPOINT.
- This change standardizes the method of accessing environment variables across the samples.

* CI: Update pom.xml version

* SAMPLE: Update invoice sample

* CI: Fix cspell issue

* README: Update sample instruction

* SAMPLE: Simplify CreateAnalyzer sample

* SAMPLE: Refactor analyzer creation in samples for improved readability by using method chaining

- Updated Sample04_CreateAnalyzer, Sample05_CreateClassifier, Sample08_UpdateAnalyzer, and Sample09_DeleteAnalyzer to use method chaining for creating ContentAnalyzer instances.

- Simplified the configuration setup for analyzers by directly initializing the ContentAnalyzerConfig within the analyzer creation process.

* CI: UPdatecseppl.json for compiler instructions  in README

* SAMPLE: Clean up messages

* SAMPLE/TEST: Generated unused generated tests

* SDK-GEN: Update with latest commit for TypeSpec to address copyAnalyzer issue

* TEST: Upload recording

* SAMPLE: Update environment variable names in GrantCopyAuth sample for consistency

- Renamed environment variables to include the prefix CONTENTUNDERSTANDING for clarity and consistency across the sample code.
- Updated related validation messages to reflect the new variable names.

* SDK-CUSTOMIZATION: Introduce simplified beginAnalyze methods in ContentUnderstandingClient and ContentUnderstandingAsyncClient

- Added new overloads for beginAnalyze methods that hide the stringEncoding parameter, aligning with .NET's approach.
- Updated sample code to reflect the new method signatures, enhancing usability and clarity.
- Introduced convenience methods for analyzing inputs with default settings, improving the API's simplicity.

* TEST: Update recording in assets.json to reflect new tag version for Azure AI Content Understanding

* Refactor content understanding samples and tests for classifier creation and analysis

- Updated Sample05_CreateClassifier to utilize ContentCategoryDefinition for defining custom categories.
- Enhanced documentation within the sample to clarify the purpose and functionality of classifiers.
- Simplified the creation of ContentAnalyzerConfig and ContentAnalyzer instances using method chaining.
- Added new tests in Sample02_AnalyzeUrl for analyzing video and audio URLs, including assertions for content validation.
- Refactored Sample04_CreateAnalyzer, Sample08_UpdateAnalyzer, and Sample09_DeleteAnalyzer to streamline analyzer creation with method chaining.
- Improved assertions in Sample05_CreateClassifier to validate content categories and analyzer configurations.

* Refactor assertions in sample tests to use static imports for improved readability

- Updated assertions in Sample05_CreateClassifier, Sample06_GetAnalyzer, Sample07_ListAnalyzers, Sample08_UpdateAnalyzer, Sample09_DeleteAnalyzer, Sample10_AnalyzeConfigs, Sample11_AnalyzeReturnRawJson, and Sample16_CreateAnalyzerWithLabels to use static imports from `org.junit.jupiter.api.Assertions`.
- Enhanced clarity and consistency across test cases by removing redundant code and improving assertion messages.
- Adjusted Sample16_CreateAnalyzerWithLabels to conditionally use labeled training data based on environment variable.

* Add async samples for deleting analysis results, copying analyzers, granting copy authorization, and creating analyzers with labeled training data

- Implement Sample13_DeleteResultAsync to demonstrate how to delete analysis results after they are no longer needed.
- Implement Sample14_CopyAnalyzerAsync to show how to copy an analyzer within the same resource.
- Implement Sample15_GrantCopyAuthAsync for cross-resource copying of analyzers with granted authorization.
- Implement Sample16_CreateAnalyzerWithLabelsAsync to create an analyzer with labeled training data from Azure Blob Storage.

* Refactor sample tests to remove async suffix from method names and update comments for clarity

* Update classifier creation samples to include 'true' for enableSegment parameter and add wait for result files in async sample

* Add retry mechanism for getResultFile in Sample12 tests and samples

The Azure Content Understanding service needs extended time after video analysis completes before result files (keyframe images) are available. This commit adds a retry mechanism:
- Tests and samples now retry up to 12 times with 10-second intervals (2 minutes total)
- Replaced @disabled annotation with retry mechanism as requested
- Consistent implementation across sync and async versions

* Update asset tag in assets.json to reflect latest version

* Update assets.json tag and modify training data SAS URL handling in analyzer creation samples for consistent test behavior

* AGENT: Add agents for compiling CU SDK in place , run samples, and run all samples to capture output

* SAMPLE: Update async sample to use reactive pattern. Add a create-cu-async-sample skill to assist async sample creation

* SAMPLE: Fix CI issue

* SAMPLE: Fix CI issue in skill md file

* Refactor samples to use reactive pattern for polling results

- Updated Sample01_AnalyzeBinaryAsync to replace synchronous polling with reactive flatMap.
- Updated Sample02_AnalyzeUrlAsync to utilize reactive chaining for polling results.
- Refactored Sample03_AnalyzeInvoiceAsync to adopt reactive pattern for operation completion.
- Modified Sample04_CreateAnalyzerAsync to implement reactive handling for analyzer creation.
- Changed Sample05_CreateClassifierAsync to use reactive approach for classifier creation.
- Updated Sample08_UpdateAnalyzerAsync to replace sync polling with reactive pattern.
- Refactored Sample09_DeleteAnalyzerAsync to adopt reactive chaining for analyzer deletion.
- Modified Sample10_AnalyzeConfigsAsync to utilize reactive pattern for analysis operation.
- Updated Sample11_AnalyzeReturnRawJsonAsync to implement reactive handling for raw JSON analysis.
- Refactored Sample12_GetResultFileAsync to use reactive pattern for retrieving result file.
- Changed Sample13_DeleteResultAsync to adopt reactive chaining for result deletion.
- Updated Sample14_CopyAnalyzerAsync to implement reactive pattern for copying analyzers.
- Refactored Sample15_GrantCopyAuthAsync to utilize reactive approach for granting copy authorization.
- Modified Sample16_CreateAnalyzerWithLabelsAsync to adopt reactive pattern for creating analyzers with labels.

* Update assets.json with new session recordings tag

* Update assets.json with Sample16 labeled training data recordings

* Add SDK skills for recording and playback testing

- Implement `sdk-push-recordings` to push session recordings to Azure SDK Assets repository.
- Create `sdk-run-all-samples` to execute all samples in sequence for validation.
- Introduce `sdk-run-sample` for running individual SDK samples.
- Develop `sdk-setup-env` to load environment variables from `.env` files for Azure SDK development.
- Add `sdk-test-playback` for running tests in PLAYBACK mode using recorded API responses.
- Implement `sdk-test-record` for capturing live API responses during tests in RECORD mode.
- Create `sdk-workflow-record-push` to orchestrate the complete process of recording tests and pushing to the Azure SDK Assets repository.
- Add scripts for running all samples, individual samples, loading environment variables, and executing tests in both RECORD and PLAYBACK modes.

* Add SDK skills for recording and playback testing

- Implement `sdk-push-recordings` skill to push session recordings to Azure SDK Assets repository.
- Create `sdk-run-all-samples` skill to execute all samples in sequence for validation.
- Introduce `sdk-run-sample` skill to run individual SDK samples for testing and debugging.
- Develop `sdk-setup-env` skill to load environment variables from `.env` files for Azure SDK development.
- Add `sdk-test-playback` skill to run tests in PLAYBACK mode using recorded API responses.
- Implement `sdk-test-record` skill to run tests in RECORD mode to capture live API responses.
- Create `sdk-workflow-record-push` skill to orchestrate the complete process of recording tests and pushing to the Azure SDK Assets repository.
- Add scripts for running all samples, running individual samples, loading environment variables, and executing tests in both RECORD and PLAYBACK modes.

* SAMPLE: Update Sample 02 to run video/audio/image too

* SKILL: Add sample quality review skill

* CI: Fix CI issues

* CUSTOMIZATION: Update TypeSpec  commit id and generate beginAnalyze[Binary] with better
 parameter order

* Add assertions and BEGIN/END markers to Sample00_UpdateDefaults tests

* Update test recordings for Sample tests

* Update README.md to include full URLs for skills documentation

* CI: Fix cusotmization code that throw exception directly, instead of via client logger

* CI: Fix javadoc issue

* Update assets.json with new tag version and enhance error handling in ContentUnderstandingClientTestBase for endpoint configuration

* Updapte sample 16 and its tests. Push recording with updated tests

* CI: Remove customization not required

* AGENT SKILL: Remove skills for better refacotring later

* CUSTOMIZATION: Updates comments

* POM: Update package name and description

* CUSTOMIZATION: Improve ContentField access methods and update convenience methods. Added type-safe getValue() methods for ContentField, ObjectField, and ArrayField to simplify value retrieval without casting. Updated beginAnalyzeBinary convenience overloads to remove unnecessary parameters and enhance usability.

* CUSTOMIZATION: Make the hidding of analyze/analyzeBinary to be robust

* README: Update pom.xml to remove test scope for azure-identity dependency and enhance README.md with clarifications on LLM requirements for analyzers.

* TEST: Refactor sample file paths in tests to new directory structure and remove obsolete sample files. Updated paths in Sample01, Sample10, and Sample11 test classes to point to 'src/samples/resources/'. Deleted unused PDF files from 'src/test/resources/'.

* [ContentUnderstanding] Update SDK to latest TypeSpec commit

* [ContentUnderstanding] Update SDK to latest TypeSpec commit (ff47dc5)

* Fix README formatting: add missing blank line before section heading

* Regenerate SDK with emitter 0.39.1 after merging main

* Fix polling context key mismatches and metadata issues in azure-ai-contentunderstanding (#47957)

* Initial plan

* Apply code review feedback: fix naming, changelog, polling keys, and remove unused imports

Co-authored-by: changjian-wang <15209050+changjian-wang@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: changjian-wang <15209050+changjian-wang@users.noreply.github.com>

* Fix polling strategy key consistency, error formatting, and async sample reliability (#47959)

* Initial plan

* Address review comments: fix error message formatting, unused imports, missing @OverRide, and use deterministic waiting in async sample

Co-authored-by: changjian-wang <15209050+changjian-wang@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: changjian-wang <15209050+changjian-wang@users.noreply.github.com>

* Fix customization to produce correct polling strategy code

- Add fixGeneratedPollingStrategyCode to customization: replaces
  String.valueOf(PollingUtils.OPERATION_LOCATION_HEADER) with
  PollingUtils.OPERATION_LOCATION_HEADER.getCaseSensitiveName()
- Fix error message comma in OperationLocationPollingStrategy
- Remove @OverRide from getResult in SyncOperationLocationPollingStrategy
- Fix ObjectField NoSuchElementException formatting

* Update sdk/contentunderstanding/azure-ai-contentunderstanding/pom.xml

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update sdk/contentunderstanding/azure-ai-contentunderstanding/src/main/java/com/azure/ai/contentunderstanding/models/KnowledgeSource.java

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update sdk/contentunderstanding/azure-ai-contentunderstanding/src/main/java/com/azure/ai/contentunderstanding/models/DocumentParagraph.java

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Fix typos in DocumentParagraph and initialize kind in KnowledgeSource

* Refactor sample applications to use CountDownLatch for async operation completion

* Update sdk/contentunderstanding/azure-ai-contentunderstanding/src/samples/java/com/azure/ai/contentunderstanding/samples/Sample06_GetAnalyzerAsync.java

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update sdk/contentunderstanding/azure-ai-contentunderstanding/src/samples/java/com/azure/ai/contentunderstanding/samples/Sample00_UpdateDefaultsAsync.java

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update version to 1.0.0 and finalize release notes for Azure Content Understanding SDK

* Remove System.exit(1) from async samples (#47966)

* Initial plan

* Remove System.exit(1) from async samples

Co-authored-by: yungshinlintw <14239352+yungshinlintw@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: yungshinlintw <14239352+yungshinlintw@users.noreply.github.com>

* Update CODEOWNERS to add additional owners for Content Understanding service

* Remove no-op fixGeneratedAnalyzeBodiesToCallImplWithUtf16 customization

The method matched 4-param beginAnalyze and 5-param beginAnalyzeBinary which
no longer exist in generated code. It was a no-op. The actual utf16 hardcoding
is handled by addBeginAnalyzeConvenienceOverloads and
addBeginAnalyzeBinaryConvenienceOverloads.

* Remove fixGeneratedPollingStrategyCode method and related calls

* Fix generated polling strategy code for case sensitivity and error message formatting

* SDKGEN: Update to the latest TypeSpec, and change to expose only getValue() for ContentField-derived classes

* SDKGEN: Update TypeSpec commit to 2849e17 (no generated code changes)

Update tsp-location.yaml to latest TypeSpec commit which includes
client.tsp reorganization and .NET-specific clientName renames.
No impact on Java generated code — regeneration produces identical output.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* SDKEXT: Add ContentRange model and overloads for beginAnalyzeBinary API

- Introduced a new ContentRange class to represent ranges of content for analysis, supporting both document pages and audio/video time ranges.
- Added overloads for the beginAnalyzeBinary method in both synchronous and asynchronous clients to accept ContentRange as a parameter.
- Updated existing methods to accommodate the new overloads and ensure proper functionality.
- Included unit tests for the ContentRange class to validate its behavior and edge cases.

* SDKGEN: FIx CI issue

* APIView: Address feedback on package name/descriptions

* SDKEXT: Update ContentUnderstanding API to use 'contentRange' instead of 'inputRange' in AnalyzeInput/analyzeBinary()

- Refactored the ContentUnderstanding API to replace 'inputRange' with 'contentRange' across multiple classes, including AnalyzeInput, ContentUnderstandingClient, and ContentUnderstandingAsyncClient.
- Updated method signatures and documentation to reflect the new parameter name, ensuring clarity in the API's usage.
- Adjusted related logic to accommodate the changes while maintaining existing functionality.

* SDKEXT: Removed analyzeBinary() that takes a string for contentRange

* SDKEXT: Enhance ContentUnderstanding with ContentSource hierarchy and grounding sources method

- Introduced a new ContentSource class hierarchy including PointF, RectangleF, and other geometry types for improved source parsing.
- Added getGroundingSources() method to ContentField to parse encoded source strings into typed grounding sources, returning an array of ContentSource instances.
- Updated related documentation to reflect these enhancements.

* SDKEXT: Enhance ContentUnderstanding with Duration properties and getters

- Added Duration-returning getters for time-based models, replacing raw millisecond getters with more user-friendly Duration types.
- Updated AudioVisualContent, AudioVisualContentSegment, TranscriptPhrase, and TranscriptWord classes to include new Duration methods.
- Modified ContentRange to support Duration parameters for time ranges, improving API usability.
- Adjusted sample code and tests to reflect these changes, ensuring consistency across the SDK.

* SDKEXT: Add Duration support to ContentUnderstandingCustomizations

- Introduced a new method to retrieve time as a Duration, enhancing usability for time-based models.
- Updated the ContentUnderstandingCustomizations class to include the new Duration method, improving the API's clarity and functionality.

* SDKGEN: Refactor Content Understanding SDK: Rename AnalyzeInput and AnalyzeResult to AnalysisInput and AnalysisResult

- Updated class and method names to improve clarity and consistency across the SDK.
- Removed deprecated AnalyzeInput and AnalyzeResult classes, replacing them with AnalysisInput and AnalysisResult.
- Adjusted related methods and documentation to reflect the new naming conventions.
- Updated tsp-location.yaml with the latest commit hash for consistency.

* SDKEXT: Remove TrackletSource from Content Understanding SDK

- Deleted the TrackletSource class and its associated parsing logic, simplifying the ContentSource hierarchy.
- Updated related classes and documentation to reflect the removal of TrackletSource, ensuring clarity in the API.
- Introduced a new method in ContentSource to reconstruct wire-format strings from ContentSource instances, enhancing usability.

* CI: Fix regeneration issue

* SDKGEN: property renaming on ContentAnalyzerConfig.set*Enabled()

* SDKAPI: Refactor ContentSource and related classes to return unmodifiable lists instead of arrays

- Updated parsing methods in AudioVisualSource, DocumentSource, and ContentSource to return unmodifiable lists for better usability and immutability.
- Renamed parsing methods for clarity, changing `parseAll` to `parse` and `parse` to `parseSingle`.
- Adjusted related tests to accommodate the new return types and method names, ensuring consistency across the SDK.

* SDKGEN: Re-generate with latest TypeSpec

- Replaced MediaContentKind with AnalysisContentKind across relevant classes to improve clarity and consistency.
- Updated AnalysisContent, AudioVisualContent, and DocumentContent to utilize the new AnalysisContentKind for content type representation.
- Adjusted parsing methods to reflect the new kind handling, ensuring backward compatibility with existing functionality.
- Removed the deprecated MediaContentKind class to streamline the codebase.

* Merge main and regenerate to align with latest TypeSpec emitter

* SDKGEN: Update TypeSpec to commit to main branch

Update model deployment parameter descriptions in Content Understanding SDK

- Revised comments in ContentUnderstandingAsyncClient, ContentUnderstandingClient, AnalyzeRequest1, and ContentUnderstandingDefaults to clarify the purpose of the modelDeployments parameter.
- Updated the commit reference in tsp-location.yaml to reflect the latest changes.

* SDKEXT: Fix bogus parameter name with *request1 pattern

* CI: Addressed speller issue

* SDKDOCS: Update README to reflect class name changes

- Renamed `AnalyzeResult` to `AnalysisResult` in the documentation for clarity and consistency with SDK updates.

* CUSTOMIZATION: Remove deprecated getTimeMs method and update documentation

- Removed the getTimeMs method from ContentUnderstandingCustomizations to eliminate redundancy.
- Updated the documentation to reflect the change and clarify the purpose of the remaining time-related method.

* TEST: Update assertions in ContentSourceTest to use Duration instead of getTimeMs

- Modified assertions in ContentSourceTest to replace the deprecated getTimeMs method with the new getTime method returning Duration.
- Ensured consistency in time-related assertions across test cases for AudioVisualSource.

* SDKEXT: Rename getGroundingSources to getSources in ContentField and update related documentation

- Renamed the method getGroundingSources to getSources in ContentField for clarity.
- Updated associated comments and documentation to reflect the new method name and its purpose.
- Removed the deprecated getTimeMs method from AudioVisualSource to streamline the codebase.

* COMMENTS: Add comments for generated model files in ContentUnderstandingCustomizations

- Added comments to clarify the purpose of string constants emitted to model files.
- Provided a list of generated output files for easier reference and review.

* SAMPLE: Add samples for listing analyzers in Content Understanding SDK

- Introduced two new sample files: Sample07_ListAnalyzers.java and Sample07_ListAnalyzersAsync.java.
- Demonstrated how to list all available analyzers (both prebuilt and custom) using synchronous and asynchronous methods.
- Included detailed output of analyzer properties, enhancing user understanding of the SDK capabilities.

* PR: Refactor ContentField and ContentSource for improved source handling

- Changed the visibility of the getSource method in ContentField to package-private and updated its implementation to use the new getSources method.
- Updated ContentSource to rename parseSource to parseAll for clarity and adjusted related documentation.
- Modified sample and test files to reflect the new source handling, demonstrating the use of getSources for typed access to content sources.
- Enhanced sample outputs to provide detailed information about document sources, including page numbers and bounding boxes.

* [SDK-UPDATE] default polling_interval to 3 seconds

---------

Co-authored-by: azure-sdk <azuresdk@microsoft.com>
Co-authored-by: Yung-Shin Lin <yslin@microsoft.com>
Co-authored-by: Changjian Wang <v-changjwang@microsoft.com>
Co-authored-by: aluneth <wangchangjian1130@163.com>
Co-authored-by: Chien Yuan Chang <ds.chienyuanchang@gmail.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: changjian-wang <15209050+changjian-wang@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: yungshinlintw <14239352+yungshinlintw@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants